package com.yhw.srb.sms.util;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "rlyun.sms")
public class SmsProperties implements InitializingBean {

    private String serverIp;
    private String serverPort;
    private String accountSId;
    private String accountToken;
    private String appId;

    public static String SERVER_IP;
    public static String SERVER_PPORT;
    public static String ACCOUNT_SID;
    public static String ACCOUNT_TOKEN;
    public static String APP_ID;

    //当私有成员被赋值后，此方法自动被调用，从而初始化常量
    @Override
    public void afterPropertiesSet() throws Exception {
        SERVER_IP = serverIp;
        SERVER_PPORT = serverPort;
        ACCOUNT_SID = accountSId;
        ACCOUNT_TOKEN = accountToken;
        APP_ID = appId;
    }

}
